<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../js/vue.js"></script>
  </head>
  <body>
    <div id="root">
     
      <h2 v-for="p in nameList">{{p}}</h2>
      <div v-for="i in m"><button>haha,我是新增的按钮</button><br><br></div>
      
      <hr>
      <button @click.once="showinfo">点我增加一行</button>
      <button @click="m++">点我增加一个按钮</button>
    </div>
  </body>
  <script>
    
    Vue.config.productionTip = false;

    new Vue({
      el: "#root",
      data() {
        return {
          nameList:[],
          n:"haha,我是新增的一行",
          m:0
        }
      },
      methods: {
        showinfo(){
          this.nameList.push(this.n)
        }
      },
    });
  </script>
</html>
